package com.houdoudou.customer.sqlite;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class DBHelper  extends SQLiteOpenHelper {
   
	public static final int VERSION=1;
	public static final String DBNAME="DBCUSTOMER";
	
	public static final String createCarSql="CREATE TABLE IF NOT EXISTS car"+
			"( " +
			"machine INTEGER ," +
			"supplier VARCHAR ," +
			"timeFlag INTEGER ," +
			"product INTEGER ," +
			"branch INTEGER  ," +			
			"number INTEGER " +		
			" )";  
			;
	public DBHelper(Context context,CursorFactory factory){
		
		super(context,DBNAME,factory,VERSION);
	}
      public DBHelper(Context context){
		
		super(context,DBNAME,null,VERSION);
	}
      

  	@Override
  	public void onCreate(SQLiteDatabase db) {
  		// TODO Auto-generated method stub
  		System.out.println("creat a database");
  	//	db.execSQL("create table user(id int,name varchar(20))");
  	//	 db.execSQL("CREATE TABLE IF NOT EXISTS person" +  
  	 //               "(_id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR, age INTEGER, info TEXT)");  
  		 db.execSQL("CREATE TABLE IF NOT EXISTS Tb_Selected_Branch" +  
  	                "(Supplier_Telnum VARCHAR  ,Product_ID INTEGER  , Product_Name VARCHAR, Branch_ID INTEGER, Branch_Name VARCHAR,Branch_Num INTEGER,Branch_UnitPrice DOUBLE,Branch_Weight INTEGER,Arrive_Time VARCHAR,Product_PicDir VARCHAR)");  
  		          // "(ordersecret VARCHAR  , boxid VARCHAR, orderstate VARCHAR, customername VARCHAR,,PRIMARY KEY (ordersecret,ordersecret))");
  	//	 db.execSQL("CREATE TABLE IF NOT EXISTS tb_box" +  
  	  //              "( boxid VARCHAR PRIMARY KEY, boxstate VARCHAR)");  
  		db.execSQL(createCarSql);
  	}
  	@Override
  	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  		// TODO Auto-generated method stub
  		System.out.println("upgrade a database");
  	}
}
